package com.aluvfy.jdbc;

import com.aluvfy.jdbc.utils.DbUtils;

import java.sql.Connection;
import java.sql.SQLException;

/*
* 在Java程序中，如何设置事务的隔离级别呢？*/
public class JDBCTest20 {
    public static void main(String[] args) {
        Connection conn = null;
        try {
            conn = DbUtils.getConnection();
            // 设置事务的隔离级别----Connection的常量来设置隔离级别
            conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);

        } catch (SQLException e) {
            throw new RuntimeException(e);
        } finally {
            DbUtils.close(conn, null, null);
        }
    }
}
